package com.gitee.source

import org.apache.flink.api.scala.ExecutionEnvironment

import scala.collection.mutable

object CollectionSource {
  def main(args: Array[String]): Unit = {
    val env: ExecutionEnvironment = ExecutionEnvironment.getExecutionEnvironment
    import org.apache.flink.api.scala._

    // 用element创建DataSet
    val element: DataSet[String] = env.fromElements("spark","flink")
    element.print()

    // 用Tuple
    val tuple: DataSet[(Int, String)] = env.fromElements((1,"spark"),(2,"flink"))
    tuple.print()

    // array
    val array: DataSet[String] = env.fromCollection(Array("spark","flink"))
    array.print()

    // List
    env.fromElements(List("spark","flink")).print()

    // Vector
    env.fromElements(Vector("spark","flink")).print()

    //Queue
    env.fromCollection(mutable.Queue("spark","flink")).print()

    // Stream
    env.fromCollection(Stream("spark","flink")).print()



  }

}
